<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>生成志愿表</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/bootstrap/css/bootstrap-submenu.css">

</head>
<body>
<!--头部引用  -->
<div class="container" id="frontTop"></div>

<div class="container xiugai" style="margin-top: 50px">
    <div class="text-center container">
        <h1 style="border: solid 1px black">本科一批</h1>
    </div>
    <div class="container" id="pdf1">
        <div class="row">
            <div class="col-md-8 text-center" style="margin-top: 40px">
                <ul>
                    <li>
                        <!--<h5>${universityScore.schoolName1}</h5>-->
                        <h5><input id="schoolName1" readonly style="border:0px; color:red"></h5>
                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th>专业</th>
                                <th>最低专业录取分</th>
                                <th>最高专业录取分</th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr>
                                <td>01计算机科学与技术</td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>02软件工程</td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>03化学工艺与工艺</td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>04化学安全工程</td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>05经济统计学</td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>06信息安全</td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore1" readonly style="border:0px"></td>
                            </tr>
                            </tbody>
                        </table>
                    </li>
                    <li>
                        <h5><input id="schoolName2" readonly style="border:0px; color:red"></h5>

                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th>专业</th>
                                <th>最低专业录取分</th>
                                <th>最高专业录取分</th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr>
                                <td>01计算机科学与技术</td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>02软件工程</td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>03化学工艺与工艺</td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>04化学安全工程</td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>05经济统计学</td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>06信息安全</td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore2" readonly style="border:0px"></td>
                            </tr>
                            </tbody>
                        </table>
                    </li>
                    <li>
                        <h5><input id="schoolName3" readonly style="border:0px; color:blue"></h5>
                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th>专业</th>
                                <th>最低专业录取分</th>
                                <th>最高专业录取分</th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr>
                                <td>01计算机科学与技术</td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>02软件工程</td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>03化学工艺与工艺</td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>04化学安全工程</td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>05经济统计学</td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>06信息安全</td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore3" readonly style="border:0px"></td>
                            </tr>
                            </tbody>
                        </table>
                    </li>

                    <li>
                        <h5><input id="schoolName4" readonly style="border:0px; color:blue"></h5>
                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th>专业</th>
                                <th>最低专业录取分</th>
                                <th>最高专业录取分</th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr>
                                <td>01计算机科学与技术</td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>02软件工程</td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>03化学工艺与工艺</td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>04化学安全工程</td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>05经济统计学</td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>06信息安全</td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore4" readonly style="border:0px"></td>
                            </tr>
                            </tbody>
                        </table>
                    </li>
                    <li>
                        <h5><input id="schoolName5" readonly style="border:0px; color:green"></h5>
                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th>专业</th>
                                <th>最低专业录取分</th>
                                <th>最高专业录取分</th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr>
                                <td>01计算机科学与技术</td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>02软件工程</td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>03化学工艺与工艺</td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>04化学安全工程</td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>05经济统计学</td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>06信息安全</td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore5" readonly style="border:0px"></td>
                            </tr>
                            </tbody>
                        </table>
                    </li>
                    <li>
                        <h5><input id="schoolName6" readonly style="border:0px; color:green"></h5>
                        <table class="table table-hover table-bordered">
                            <thead>
                            <tr>
                                <th>专业</th>
                                <th>最低专业录取分</th>
                                <th>最高专业录取分</th>
                            </tr>
                            </thead>

                            <tbody>
                            <tr>
                                <td>01计算机科学与技术</td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>02软件工程</td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>03化学工艺与工艺</td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>04化学安全工程</td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>05经济统计学</td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                            </tr>
                            <tr>
                                <td>06信息安全</td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                                <td><input name="schoolAdmissionScore6" readonly style="border:0px"></td>
                            </tr>
                            </tbody>
                        </table>
                    </li>
                </ul>
            </div>
            <div class="col-md-1" style="margin-top: 40px">
                <div style="border: solid 1px black;margin-top: 85px">
                    <p style="margin-top: 50px;margin-bottom: 50px">录取率<br>分析：<br>根据往<br>年绿区<br>分数线<br>统计，<br>改院校<br>录取率<br>为<label
                            style="color: red">30%</label></p>
                </div>
                <div style="border: solid 1px black;margin-top: 105px">
                    <p style="margin-top: 50px;margin-bottom: 50px">录取率<br>分析：<br>根据往<br>年绿区<br>分数线<br>统计，<br>改院校<br>录取率<br>为<label
                            style="color: red">30%</label></p>
                </div>
                <div style="border: solid 1px black;margin-top: 105px">
                    <p style="margin-top: 50px;margin-bottom: 50px">录取率<br>分析：<br>根据往<br>年绿区<br>分数线<br>统计，<br>改院校<br>录取率<br>为<label
                            style="color: red">50%</label></p>
                </div>

                <div style="border: solid 1px black;margin-top: 110px">
                    <p style="margin-top: 50px;margin-bottom: 50px">录取率<br>分析：<br>根据往<br>年绿区<br>分数线<br>统计，<br>改院校<br>录取率<br>为<label
                            style="color: blue">60%</label></p>
                </div>

                <div style="border: solid 1px black;margin-top: 110px">
                    <p style="margin-top: 50px;margin-bottom: 50px">录取率<br>分析：<br>根据往<br>年绿区<br>分数线<br>统计，<br>改院校<br>录取率<br>为<label
                            style="color: green">75%</label></p>
                </div>
                <div style="border: solid 1px black;margin-top: 110px">
                    <p style="margin-top: 50px;margin-bottom: 50px">录取率<br>分析：<br>根据往<br>年绿区<br>分数线<br>统计，<br>改院校<br>录取率<br>为<label
                            style="color: green">90%</label></p>
                </div>

            </div>

            <div class="col-md-2 offset-1" style="margin-top: 60px;">
                <div style="color: white;" class="text-center">
                    <h5 style="background: red;">0%-40%<br>显示为红<br>色，不大<br>可能被录<br>取</h5>
                    <br>
                    <h5 style="background: blue;"> 40%-70%<br>为蓝色可<br>以冲一下</h5>
                    <br>
                    <h5 style="background: green;"> 70-100%<br>为绿色，<br>肯定可以<br>录取的</h5>
                </div>
            </div>
        </div>
    </div>

    <div class="row" id="downLoadParents">
        <div class="col-md-2 offset-3">
            <a id="downLoad" class="btn btn-primary" style="width: 100%" href="javascript:void(0)">导出志愿表</a>
        </div>
        <div class="col-md-2 offset-1">
            <a class="btn btn-primary " style="width: 100%" href="mainPage">退出</a>
        </div>
    </div>
</div>
<!--底部信息  -->
<div class="container" id="frontBottom"></div>

<script src="/js/jquery-3.3.0.js"></script>
<script src="/layui/layui.js"></script>
<script src="/js/core.util.js"></script>
<script src="/bootstrap/bootstrap.min.js"></script>
<script src="/js/html2canvas.js"></script>
<script src="/js/jspdf.debug.js"></script>
<!--打印页面为pdf-->
<script>
    var storage = window.sessionStorage;
    var universityScore = storage.getItem("universityScore");
    $(document).ready(function () {
        var storage = window.sessionStorage;
        $("#frontTop").load("/index/frontTop");
        $("#frontBottom").load("/index/frontBottom");
        var sutject = storage.getItem("subject");
        var grade = storage.getItem("grade");
        var category = 0;
        if (sutject == "文科") {
            category = 1
        }
        dataJson = {
            category: category,
            score: grade,
        };
        // var universityScore;
        layui.use(['jquery', 'form'], function () {
            var $ = layui.jquery;
            CoreUtil.sendAjax("/v1/fillcee/voluntaryForm", JSON.stringify(dataJson), function (res) {
                var universityScore = res.data;

                document.getElementById("schoolName1").value = universityScore.schoolName1;
                var schoolAdmissionScore = document.getElementsByName("schoolAdmissionScore1");
                for (var i = 0; i < schoolAdmissionScore.length; i++) {
                    schoolAdmissionScore[i].value = universityScore.schoolAdmissionScore1;
                }

                document.getElementById("schoolName2").value = universityScore.schoolName2;
                schoolAdmissionScore = document.getElementsByName("schoolAdmissionScore2");
                for (var i = 0; i < schoolAdmissionScore.length; i++) {
                    schoolAdmissionScore[i].value = universityScore.schoolAdmissionScore2;
                }

                document.getElementById("schoolName3").value = universityScore.schoolName3;
                schoolAdmissionScore = document.getElementsByName("schoolAdmissionScore3");
                for (var i = 0; i < schoolAdmissionScore.length; i++) {
                    schoolAdmissionScore[i].value = universityScore.schoolAdmissionScore3;
                }

                document.getElementById("schoolName4").value = universityScore.schoolName4;
                schoolAdmissionScore = document.getElementsByName("schoolAdmissionScore4");
                for (var i = 0; i < schoolAdmissionScore.length; i++) {
                    schoolAdmissionScore[i].value = universityScore.schoolAdmissionScore4;
                }

                document.getElementById("schoolName5").value = universityScore.schoolName5;
                schoolAdmissionScore = document.getElementsByName("schoolAdmissionScore5");
                for (var i = 0; i < schoolAdmissionScore.length; i++) {
                    schoolAdmissionScore[i].value = universityScore.schoolAdmissionScore5;
                }

                document.getElementById("schoolName6").value = universityScore.schoolName6;
                schoolAdmissionScore = document.getElementsByName("schoolAdmissionScore6");
                for (var i = 0; i < schoolAdmissionScore.length; i++) {
                    schoolAdmissionScore[i].value = universityScore.schoolAdmissionScore6;
                }

            }, "POST", false);
        });
        // var universityScore = storage.getItem("universityScore");
        // alert(universityScore.schoolAdmissionScore6)
        // $("#universityScore.schoolName1").html(universityScore.schoolName1)
    });
    // var universityScore = storage.getItem("universityScore");
    // alert(universityScore.schoolAdmissionScore6)
    var downPdf = document.getElementById("downLoad");
    downPdf.onclick = function () {
        // downPdf.parentNode.removeChild(downPdf);
        html2canvas(document.getElementById('pdf1'), {
            onrendered: function (canvas) {
                var contentWidth = canvas.width;
                var contentHeight = canvas.height;

                //一页pdf显示html页面生成的canvas高度;
                var pageHeight = contentWidth / 592.28 * 841.89;
                //未生成pdf的html页面高度
                var leftHeight = contentHeight;
                //pdf页面偏移
                var position = 0;
                //a4纸的尺寸[595.28,841.89]，html页面生成的canvas在pdf中图片的宽高
                var imgWidth = 595.28;
                var imgHeight = 592.28 / contentWidth * contentHeight;

                var pageData = canvas.toDataURL('image/png', 1.0);

                var pdf = new jsPDF('', 'pt', 'a4');

                //有两个高度需要区分，一个是html页面的实际高度，和生成pdf的页面高度(841.89)
                //当内容未超过pdf一页显示的范围，无需分页
                if (leftHeight < pageHeight) {
                    pdf.addImage(pageData, 'png', 0, 0, imgWidth, imgHeight);
                } else {
                    while (leftHeight > 0) {
                        pdf.addImage(pageData, 'png', 0, position, imgWidth, imgHeight)
                        leftHeight -= pageHeight;
                        position -= 841.89;
                        //避免添加空白页
                        if (leftHeight > 0) {
                            pdf.addPage();
                        }
                    }
                }
                pdf.save('志愿表.pdf');
            }
        })

    }
</script>


</body>
</html>